package com.example.appstorenew.utils;


import com.example.appstorenew.pojo.appRecommend;
import com.example.appstorenew.pojo.appRecommendGeneral;
import com.google.gson.Gson;

import java.io.IOException;
import java.util.List;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class AppRecommendUtil {
    public static List<appRecommend> getAppRecommendList(String token) throws IOException {

        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        Request request = new Request.Builder()
                .url(BaseUrl.baseUrl+"/dev-api/bs-app-store/app/list")
                .get()
                .addHeader("Authorization", "Bearer "+token)
                .build();
        Response response = client.newCall(request).execute();
        Gson gson = new Gson();
        appRecommendGeneral general = gson.fromJson(response.body().string(), appRecommendGeneral.class);
        return general.getData();
    }
}
